<template>
  <div class="mobile-food-view common-mobile-view">
    <food-stats />

    <food-calendar />

    <draggable-button @click="addClick"/>
  </div>
</template>

<script lang="ts" setup>
import FoodStats from '@/components/Food/FoodStats.vue'
import FoodCalendar from '@/components/Food/FoodCalendar.vue'
import DraggableButton from '@/components/Common/DraggableButton.vue'
import { useRouter } from 'vue-router'
import { useFoodStore } from '@/store/food.ts'
import { onMounted } from 'vue'

const foodStore = useFoodStore()
const router = useRouter()

onMounted(async () => {
  await foodStore.refreshInfo()
})

const addClick = () => {
  foodStore.foodRecordApiType = 'ADD'
  foodStore.currentFoodRecord = foodStore.getEmptyFoodRecord()
  router.push({ name: 'FoodRecordForm' })
}
</script>

<style lang="scss">
@use "@/styles/home/food.mobile.module";
</style>
